//
//  ReportCardTitleView.m
//  SchoolHelper
//
//  Created by 任辰东 on 2022/8/24.
//  Copyright © 2022 JSY. All rights reserved.
//

#import "ReportCardTitleView.h"

@interface ReportCardTitleView ()

@property (nonatomic, strong) UIView *markView;
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation ReportCardTitleView

-(void)configViewWithTitle:(NSString *)title
{
    self.titleLabel.text = title;
}

-(void)setupViews
{
    self.backgroundColor = UIColorFromHex(kColorWhite);
    [self addSubview:self.markView];
    [self addSubview:self.titleLabel];
}

-(void)setupLayout
{
    [self.markView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self).offset(5);
        make.left.equalTo(self).offset(15);
        make.bottom.equalTo(self).offset(-5);
        make.height.mas_equalTo(13);
        make.width.mas_equalTo(4);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.bottom.equalTo(self);
        make.left.equalTo(self.markView.mas_right).offset(8);
        make.right.equalTo(self).offset(-15);
    }];
}


#pragma mark -- lazyload

-(UIView *)markView
{
    if (!_markView) {
        _markView = [UIView new];
        _markView.backgroundColor = UIColorFromHex(kColorMain);
    }
    return _markView;
}

-(UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textColor = UIColorFromHex(0x000000);
        _titleLabel.font = UIFontSize(14);
    }
    return _titleLabel;
}

@end
